package cn.itcast.bos.transit.action;

import java.util.HashMap;
import java.util.Map;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import cn.itcast.bos.base.action.BaseAction;
import cn.itcast.bos.domain.transit.SignInfo;
import cn.itcast.bos.transit.service.SignInfoServcie;

@ParentPackage("json-default")
@Scope("prototype")
@Controller
@Namespace("/")
public class SignInfoAction extends BaseAction<SignInfo>{

	@Autowired
	private SignInfoServcie signInfoServcie;
	
	@Action(value="signSave",results={@Result(name="success",type="json")})
	public String signSave(){
		Map<String,Object> map=new HashMap<String,Object>();
		try {
			signInfoServcie.save(t);
			map.put("flag", true);
			map.put("msg", "配送成功");
			ServletActionContext.getContext().getValueStack().push(map);
		} catch (Exception e) {
			// TODO: handle exception
			map.put("flag", false);
			map.put("msg", "配送失败"+e.toString());
			ServletActionContext.getContext().getValueStack().push(map);
			e.printStackTrace();
		}
		return SUCCESS;
	}
}
